package com.kotlin.demo.ui

import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Card
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.kotlin.demo.constant.Constants
import com.kotlin.demo.enums.DialogType
import exportExcelDialog
import loadingDialog

/**
 * 编辑key 弹窗
 */
@Composable
@Preview
internal fun showHomeDialog() {
    if (!Constants.isShowDialog.value) {
        return
    }
    Box(
        modifier = Modifier.background(Color(0x5A000000)).fillMaxSize(),
        contentAlignment = Alignment.Center
    ) {
        Card(
            shape = RoundedCornerShape(8.dp),
            backgroundColor = Color.White,
        ) {
            when (Constants.dialogType.value) {
                DialogType.LOADING -> {//loading 弹框
                    loadingDialog()
                }

                DialogType.TOAST -> {//提示弹框
                    showTipsDialog()
                }

                DialogType.ADD_PATH -> {//增加路径
                    addResPath()
                }

                DialogType.EDIT_KEY -> {//提示修改res Key弹框
                    editKeyUi()
                }

                DialogType.REPLACE_KEY -> {//提示替换 Key弹框
                    replaceTranslateKeyView()
                }

                DialogType.REMOVE_KEY -> {//提示移除 对应的多语言弹窗
                    removeTranslateKeyView()
                }

                DialogType.SHOW_KEY -> {//提示预览 对应的多语言弹窗
                    findTranslateKeyView()
                }

                DialogType.EXPORT -> {// 导出对语言弹窗
                    exportExcelDialog()
                }
                DialogType.EDIT -> {// 导出对语言弹窗
                    EditLanguageConfigDialog()
                }
            }
        }
    }
}

